package work20241227;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

/**
 * @author zdl
 * @date 2024/12/27
 */
public class Demo2 {
    public static void main(String[] args) {
        test1(() -> {
            String str = "qweq";
            return str.length();
        });
        test2((s) -> System.out.println(s.toUpperCase()));
        test3(s -> Integer.parseInt(s));
        test4(s -> s % 2 == 0);
    }

    public static void test1(Supplier<Integer> supplier) {
        Integer s = supplier.get();
        System.out.println(s);
    }

    public static void test2(Consumer<String> consumer) {
        consumer.accept("abcd");
    }

    public static void test3(Function<String, Integer> function) {
        Integer apply = function.apply("999");
        System.out.println(apply);
    }

    public static void test4(Predicate<Integer> predicate) {
        boolean test = predicate.test(89);
        System.out.println(test);
    }
}
